package com.xbongbong.admin.model.impl;

import com.xbongbong.admin.domain.dao.MirrorConfigDao;
import com.xbongbong.admin.domain.entity.MirrorConfigEntity;
import com.xbongbong.admin.model.MirrorConfigModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 镜像配置
 * @author xingxing.xiao
 * @date 2020/01/09 14:56
 */
@Service("mirrorConfigModel")
public class MirrorCofigModelImpl implements MirrorConfigModel {

    @Resource
    private MirrorConfigDao mirrorConfigDao;

    @Override
    public Integer insert(MirrorConfigEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return mirrorConfigDao.insert(entity);
    }

    @Override
    public Integer update(MirrorConfigEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setUpdateTime(now);
        return mirrorConfigDao.update(entity);
    }

    @Override
    public List<MirrorConfigEntity> findEntitys(Map<String, Object> param) {
        return mirrorConfigDao.findEntitys(param);
    }

    @Override
    public MirrorConfigEntity getByKey(Long key) {
        return mirrorConfigDao.getByKey(key);
    }

    @Override
    public Integer updateBatch(List<MirrorConfigEntity> list) {
        return mirrorConfigDao.updateBatch(list);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return mirrorConfigDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
